<?php @list($id, $email, $type) = explode('*', $this->element->getValue(false)); ?>
<dt>
    <?= $this->formLabel($this->element->getName(), $this->element->getLabel()); ?>
</dt>
<dd>
    <input type="hidden"
           name="<?= $this->element->getName(); ?>[0]" 
           class="email-id"
           value="<?= $id; ?>" />
    
    <input id="<?= $this->element->getName(); ?>_1" 
           type="text"
           class="email-address"
           name="<?= $this->element->getName(); ?>[1]" 
           value="<?= $email; ?>" />
    
    <?php
        $mapper    = new Application_Model_EmailTypeMapper();
        $mailtypes = $mapper->fetchAll();
        
        echo '<select name="'.$this->element->getName().'[2]" class="email-select-type">';
            echo '<option value="">Select type</option>';
                
            if(count($mailtypes))
            {
                foreach($mailtypes as $mailtype)
                {
                    echo '<option value="'.$mailtype->Id.'"'.($type == $mailtype->Id ? ' selected="selected"' : '').'>'
                            .$mailtype->Name
                        .'</option>';
                }
            }
        
        echo '</select>';
    ?>
 
    <?php if(count($this->element->getMessages()) > 0): ?>
        <?= $this->formErrors($this->element->getMessages()); ?>
    <?php endif; ?>
</dd>